<%@ page language="java"
         contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"
         import="com.shxt.hotel.background.Consume"
         import="com.shxt.hotel.background.User"
         import="java.util.List"
         import="java.util.Map"
         import="com.shxt.hotel.background.Staff"
%>
<%
    Staff staff = new Staff();
    
    if(session.getAttribute("staff_id") == null){
        response.sendRedirect("./login.jsp");
    }else{
        // get current Staff
        request.setCharacterEncoding("UTF-8");
        int staff_id = (int)session.getAttribute("staff_id");

        Consume consume = new Consume();
        User user = new User();
%>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="Mosaddek">
    <link rel="shortcut icon" href="../Public/img/favicon.html">

    <title>Consume Info</title>

    <!-- Bootstrap core CSS -->
    <link href="../Public/css/bootstrap.min.css" rel="stylesheet">
    <link href="../Public/css/bootstrap-reset.css" rel="stylesheet">
    <!--external css-->
    <link href="../Public/assets/font-awesome/css/font-awesome.css" rel="stylesheet" />
    <!-- Custom styles for this template -->
    <link href="../Public/css/style.css" rel="stylesheet">
    <link href="../Public/css/style-responsive.css" rel="stylesheet" />

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 tooltipss and media queries -->
    <!--[if lt IE 9]>
      <script src="../Public/js/html5shiv.js"></script>
      <script src="../Public/js/respond.min.js"></script>
    <![endif]-->
</head>

<body>

    <section id="container" class="">
        <!--header start-->
        <jsp:include page="./Public/header.jsp" flush="true" />
        <!--header end-->
        <!--sidebar start-->
        <jsp:include page="./Public/sidebar.jsp" flush="true" />
        <!--sidebar end-->
        <!--main content start-->
        <section id="main-content">
            <section class="wrapper">
                <!-- page start-->
                <div class="row">
                    <div class="col-lg-9">
                        <section class="panel panel-primary">
                            <header class="panel-heading">
                                Consume INFO
                            </header>
                            <table class="table table-striped table-advance table-hover">
                                <thead>
                                    <tr>
                                        <th><i class="icon-bullhorn"></i> Consume Name</th>
                                        <th class="hidden-phone"><i class="icon-question-sign"></i> Consume Num</th>
                                        <th><i class="icon-bookmark"></i> User Name</th>
                                        <th><i class=" icon-edit"></i> User phone</th>
                                        <th> Deposit</th>
                                        <th>Operation</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <%
                                        //consume_info
                                        List<Map<String, Object>> consumeInfoList = consume.getConsumeInfo();
                                        for(Map<String, Object> consumeInfo : consumeInfoList){
                                            Map<String, Object> consumeRec = consume.getConsume((int)consumeInfo.get("cid"));
                                            Map<String, Object> consumeUser = user.getUserInfo((int)consumeInfo.get("uid"));
                                    %>
                                    <tr>
                                        <td><a href="#"><%=consumeRec.get("title") %></a></td>
                                        <td class="hidden-phone"><%=consumeInfo.get("num") %></td>
                                        <td><%=consumeUser.get("username") %></td>
                                        <td><%=consumeUser.get("phone") %></td>
                                        <td>$ <%=consumeInfo.get("deposit") %></td>
                                        <td>
                                            <a href='./background/consume_info_do.jsp?id=<%=consumeInfo.get("id") %>'>
                                                <button type="button" class="btn btn-info btn-xs">Order</button>
                                            </a>
                                        </td>
                                    </tr>
                                    <%
                                        }
                                    %>
                                </tbody>
                            </table>
                        </section>
                    </div>
                </div>
                <!-- page end-->
            </section>
        </section>
        <!--main content end-->
    </section>

    <!-- js placed at the end of the document so the pages load faster -->
    <script src="../Public/js/jquery.js"></script>
    <script src="../Public/js/bootstrap.min.js"></script>
    <script src="../Public/js/jquery.scrollTo.min.js"></script>
    <script src="../Public/js/jquery.nicescroll.js" type="text/javascript"></script>


    <!--common script for all pages-->
    <script src="../Public/js/common-scripts.js"></script>
    <!--scripted by myself-->
    <script>
        $(document).ready(function(){
            $("#Hotel_Consume").addClass("active");
            $("#consume_info").addClass("active");
        });
    </script>

</body>

</html>
<%
    }
%>